﻿/*
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/

Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
License for the specific language governing rights and limitations
under the License.
*/
package com.jorritdevries.console
{
	import flash.events.Event;

	/**
	 * Signals the UIConsole has been resized.
	 * @author jorrit@jorritdevries.com
	 */
	public class ResizeEvent extends Event
	{
		public static const RESIZE:String = "resize";
		
		private var mWidth:Number;
		private var mHeight:Number;
		private var mX:Number;
		private var mY:Number;
		
		/**
		 * 
		 * @param type
		 * @param bubbles
		 * @param cancelable
		 */
		public function ResizeEvent(type:String, width:Number, height:Number, 
			x:Number = 0, y:Number = 0, bubbles:Boolean = false, cancelable:Boolean = false)
		{
			super(type, bubbles, cancelable);
			mWidth = width;
			mHeight = height;
			mX = x;
			mY = y;
		}
		
		/**
		 * @see http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/Event.html#clone()
		 */
		public override function clone():Event
		{
			return new ResizeEvent(type, mWidth, mHeight, mX, mY, bubbles, cancelable);
		}
		
		/**
		 * 
		 */
		public function get width():Number
		{
			return mWidth;
		}
		
		/**
		 * 
		 */
		public function get height():Number
		{
			return mHeight;
		}
		
		/**
		 * 
		 */
		public function get x():Number
		{
			return mX;
		}
		
		/**
		 * 
		 */
		public function get y():Number
		{
			return mY;
		}
		
		/**
		 * @see http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/events/Event.html#toString()
		 */
		public override function toString():String
		{
			return formatToString("ParseErrorEvent", "type", "width", "height", "x", "y",
				"bubbles", "cancelable", "eventPhase");
		}
	}
	
}